{% extends "stocksys/base/base_page.html" %}
{% load staticfiles %}
{% block content %}
    <script src="{% static 'stocksys/js/echarts.min.js' %}" type="text/javascript" charset="utf-8"></script>
    <script src="{% static 'stocksys/js/k-line.js' %}" type="text/javascript" charset="utf-8"></script>
    {% csrf_token %}
    <div class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div id="industry_info" class="card" style="min-height: 350px">
                        <div class="header card-header-icon">
                            <h4 class="title" id="industry_name"><i
                                    class="ti-pulse"></i> {{ stock_address }}-{{ stock.stock_name }}
                            </h4>
                        </div>
                        <div class="content " id="k-content" style="height:300px ;padding: 10px"></div>
                        <script>
                            var csrf = $('input[name="csrfmiddlewaretoken"]').val();
                            var year = new Date().getFullYear();
                            var url = "/stocksys/stock_info/{{ exchange_code }}/" + "{{ exchange_addr }}/" + year;
                            $.ajax({
                                url: url,
                                data: {'csrfmiddlewaretoken': csrf},
                                dataType: "json",
                                type: "POST",
                                success: function (data) {
                                    kdata = data["data"];
                                    var kChart = echarts.init(document.getElementById('k-content'));
                                    kChart.setOption(initKOption(kdata));
                                    $("#k-content canvas").css({"width": "100%", "height": "100%"});
                                    $("#k-content div").css({"width": "100%", "height": "100%"});
                                },
                                error: function (xhr, status, error) {

                                }
                            });
                        </script>
                        {% block prediction %}
                        {% endblock %}
                        <table id="datatables" class="table table-striped table-no-bordered table-hover"
                               style="width:100%;cellspacing:0">
                            <thead>
                            <tr>
                                <th>参数</th>
                                <th>指标</th>
                            </tr>
                            <tbody>
                            <tr>
                                <th>上市日期</th>
                                <th>{{ stock.start_date | date:'Y-m-d' }}</th>
                            </tr>
                            <tr>
                                <th>退市日期</th>
                                <th>{{ stock.end_date | date:'Y-m-d' }}</th>
                            </tr>
                            <tr>
                                <th>缩写</th>
                                <th>{{ stock.exchange_abbreviated_name }}</th>
                            </tr>
                            </tbody>
                        </table>

                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}


{% block pagescript %}
{% endblock %}

